import React from 'react'
import {gql, useLazyQuery} from '@apollo/client';

const AccountGql = gql`
    query Account($id: ID!) {
        account(id: $id) {
            id
            username
            password
        }
    }
`;

export const Page4: React.FC = () => {
    const [getAccount, { loading: loading2, data: account }] = useLazyQuery(AccountGql);
    console.log(account, '根据条件返回的数据');
    return (
        <div>
            点击按钮请求数据
            <button onClick={() => getAccount({variables: {id:2}})}>传递参数按钮</button>
        </div>
    )
}
